package com.algo.core.filter;

import com.algo.core.RequestContext;
import org.apache.log4j.Logger;

/**
 * 请求日志记录过滤器
 */
public class LoggerFilter implements RapidFilter {

    private final static Logger logger = Logger.getLogger(LoggerFilter.class);

    @Override
    public void doFilter(RequestContext requestContext, RapidFilterChain chain) {
        logger.info("http request url is " + requestContext.getHttpRequestWrapper().getRequest().getUri());
        chain.doFilter(requestContext, this);
    }

    @Override
    public int getOrder() {
        return FilterOrder.LOGGER_FILTER.order;
    }

}
